clear all
set more off
cap log close


********************************************************************************
***** Project: The Short and Long Term Effects of In-Person Performance Feedback
********************************************************************************
***** A. R. Soetevent & G. J. Romensen
********************************************************************************
***** Retrieving weather data from weather station KNMI
********************************************************************************
***** Latest update: 18-01-2020
********************************************************************************
*global filepath "C:\JPEMicReplication"
log using "$filepath/Logs/03Weather.log", replace

import delimited "$filepath\Data\Using databases\KNMI_20170227(1).txt"
keep yyyymmdd rh tg fg

drop if yyyymmdd<20150101
drop if yyyymmdd>20170131

tostring yyyymmdd, replace

gen datum=date(yyyymmdd, "YMD")
format datum %td
drop yyyymmdd
order datum

gen neerslagsom=rh / 10
drop rh
replace neerslagsom=0 if neerslagsom<0
label variable neerslagsom "(in mm)"

gen gem_temp=tg / 10
drop tg
label variable gem_temp "(in graden Celsius)"

gen gem_wind=fg / 10
drop fg
label variable gem_wind "(in meters per seconde)"

sort datum

save "$filepath\Data\Using databases\weather.dta", replace
